package com.yhsimon.mediator.smarthouse;

/**
 * @author： YHSimon
 * @date： 2021-10-19 09:47
 */
public class Alarm extends Colleague {
    public Alarm(Mediator mediator,String name){
        super(mediator,name);
        //在创建同事对象时，将自己放入到ConcreteMediator
        mediator.register(name,this);
    }


    public void sendAlarm(int stateChange) {
        sendMessage(stateChange);
    }

    public void sendMessage(int stateChange){
        //调用的中介者对象的getMessage
        this.getMediator().getMessage(stateChange,this.name);
    }
}
